package server.business.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.poi.ss.formula.functions.T;
import server.business.pojo.BloodInformationVo;
import server.main.config.cache.MybatisPlusRedisCache;
import server.business.pojo.BloodInformation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;

/**
* @author Galaxy
* @description 针对表【blood_information】的数据库操作Mapper
* @createDate 2022-11-08 12:46:23
* @Entity server.business.pojo.BloodInformation
*/
@Mapper
//@CacheNamespace(implementation = MybatisPlusRedisCache.class)
public interface BloodInformationMapper extends BaseMapper<BloodInformation> {
    /**
    通过血液编号找到血液
     */
    @Select("select * from blood_information where blood_id=#{bloodId}")
    BloodInformation selectByBloodNumber(String bloodId);
//    /**
//     * 通过血液样本编号找到血液
//     */
//    @Select("select * from blood_information where blood_id=#{bloodNumber}")
//    BloodInformation selectByBloodSampNumber(String bloodNumber);

    /**
     * 根据血型、血液成分、找到可以更换的在库的血液
     */
    List<BloodInformationVo> selectChangeBlood(String aboBloodType, String rhBloodType, String bloodComponent,
                                               Integer bloodCount);




    IPage<BloodInformation> selectBloodpage(IPage<T> page, @Param(Constants.WRAPPER) Wrapper<BloodInformation> queryWrapper);




    //*************************************zy*************************start

    /**
     * 血站在库血液信息查询模块
     *
     * @return 返回血站在库血液信息列表
     */
    List<BloodInformation> findStationBloodInformation();

    /**
     * 根据血液Id设置血液状态
     *
     * @param bloodNumber 血液Id
     * @param condition   待设置的血液状态
     */
    void setConditionByBloodNumber(String bloodNumber, String condition);
    //*************************************zy*************************end


}




